package top.rainbowecho.upload.infrastructure.db.data;

import lombok.Getter;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import top.rainbowecho.common.domain.shared.ValueObject;

import java.time.LocalDateTime;

/**
 * @author rainbow
 * @since 2019/12/7 12:04
 */
@Getter
@NoArgsConstructor
@Document("upload")
public class UploadRecord implements ValueObject<UploadRecord> {
    @Id
    private String id;

    private String storePath;

    private String username;

    /**
     * 上传的文件的文件名，含扩展名
     */
    private String filename;

    private LocalDateTime when;

    /**
     * 1为敏感内容，0为不敏感
     */
    private int sensitive;

    private String label;

    public UploadRecord(String storePath, String username, String filename, LocalDateTime when, int sensitive, String label) {
        this.storePath = storePath;
        this.username = username;
        this.filename = filename;
        this.when = when;
        this.sensitive = sensitive;
        this.label = label;
    }

    /**
     * 值对象的比较方法
     *
     * @param other 比较对象
     * @return true表示值对象相等，反之不等
     */
    @Override
    public boolean sameValueAs(UploadRecord other) {
        return false;
    }
}
